
#include <cstdlib>
#include <BString>
#include "ILibStdlib.h"

using namespace BWE;

ILibrary* ILibStdlib::Instance()
{
	static ILibrary library("cstdlib");
	if (library.empty())
	{
		library.registFunction("void sleep(double)", sleep);
		library.registFunction("int rand()", rand);
	}
	return &library;
}
void ILibStdlib::sleep(int argc, BValue* argv)
{
	double seconds = argv[1];
	bSleep(seconds);
}
void ILibStdlib::rand(int argc, BValue* argv)
{
	argv[0] = ::rand();
}

